package com.cuijq.ms.logger.impl;

import com.cuijq.ms.logger.Logger;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.logging.Level;

class FileLogger extends Logger {
    private Writer fileWriter;

    public FileLogger(String name, boolean enabled, Level minPermittedLevel, String filepath) {
        super(name, enabled, minPermittedLevel);
        try {
            this.fileWriter = new FileWriter(filepath);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doLog(Level level, String mesage) {
        try {
            // 格式化level和message,输出到日志文件
            fileWriter.write("");
        } catch (Exception e) {

        }
    }
}// 抽象类的子类: 输出日志到消息中间件(比如kafka)

